import init, { render_pdf_to_canvas } from './pkg/wasm_game_of_life.js';

async function loadPdf(event) {
    const file = event.target.files[0];
    if (!file) return;

    const pdfData = new Uint8Array(await file.arrayBuffer());
    await render_pdf_to_canvas(pdfData, "pdf-canvas", 0);
}

document.getElementById('pdf-file-input').addEventListener('change', loadPdf);

init().catch(console.error);